import Request from "../../utils/Request";
import {ImageFile} from "../../interface/index";


export class ProductService {
    static getCategories(params: { store_id: String }) {
        return Request.get(Request.getApi().categoryList, params);
    }

    static createCategory(params: { store_id: string, store_menu: string }) {
        return Request.post(Request.getApi().categoryAdd, params);

    }

    static topCategories() {
        return Request.get(Request.getApi().topCategories);
    }


    static add(params: { store_id: string, category_id: string, store_data_id: string, name: string, spec: string, summary: string, preview: ImageFile, price: string | number }) {
        return Request.post(Request.getApi().productAdd, params);
    }

    static edit(params: { store_id: string, category_id: string, store_data_id: string, name: string, spec: string, summary: string, preview: ImageFile, price: string | number }) {
        return Request.post(Request.getApi().productEdit, params);
    }

    static del(params: { store_id: string | number, product_id: string | number }) {
        return Request.get(Request.getApi().productDelete, params);
    }

    static list(params: { store_id: string, store_cate_id: string }) {
        return Request.get(Request.getApi().productList, params);
    }

    static more(url: string, params: { store_id: string, store_cate_id: string }) {
        return Request.get(url, params);
    }
}